﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using thousandclear.Data;
using thousandClear.Areas.Admin.Models;
using thousandClear.Util.Setting;

namespace thousandClear.Areas.Shop.Controllers
{
    public class RenewController : Controller
    {
        // GET: Shop/Renew
        public ActionResult Index(string openid,string order)
        {
            AppSetting setting = new AppSetting();
            ViewBag.OpenId = openid;
            List<ProjectModel> list = new List<ProjectModel>();
            using (var db = new qianjingEntities())
            {
                var orderDetail = db.v_Order.FirstOrDefault(a => a.toSerialNo==order);
                var records = db.D_item.OrderBy(a => a.DIMID).Where(a => a.RowStatus == 1 && a.dimType == 1).ToList();
                foreach (var item in records)
                {
                    list.Add(new ProjectModel
                    {
                        dimDesc = item.dimDesc,
                        dimName = item.dimName,
                    });
                }
                var query = db.D_item.OrderBy(a => a.DIMID).Where(a => a.RowStatus == 1 && a.dimType == 2).ToList();
                ViewBag.T2 = query;
                var Good = db.O_Goods.OrderBy(a => a.ogsType).ThenBy(a => a.ogsTimeMonth).ThenBy(a => a.ogsArea).Where(a => a.RowStatus == 1 && a.ogsType != 1).ToList();
                ViewBag.goodsMessage = Good[0];
            }
            ViewBag.OpenId = openid;
            return View(list);
        }
    }
}